$(function () {
   // 定义事件处理
    document.onkeydown = function (event) {
        switch (event.key) {
            case 'a':
                bLeft = true;
                bRight=false;
                break;
            case 'w':
                bTop = true;
                bBottom=false;
                break;
            case 'd':
                bRight = true;
                bLeft=false;
                break;
            case 's':
                bBottom = true;
                bTop=false;
                break;
        }
    };
    document.onkeyup = function (event) {
        switch (event.key) {
            case 'a':
                bLeft = false;
                break;
            case 'w':
                bTop = false;
                break;
            case 'd':
                bRight = false;
                break;
            case 's':
                bBottom = false;
                break;
        }
    };
});